#include <amxmodx>
#include <amxmisc>
#include <dprp>

#define PHONE_RING_OFFSET 1983712738

enum _:PHONE
{
	MODE = 0,
	RING,
	CALLER,
	CALLING,
	TALKING,
	RINGING
}

// flag A
#define POLICE_ACCESS ACCESS_A

#define ANSWER_ITEMS 3
#define STATUS_SETTINGS 3
#define RING_SETTINGS 3

new Float:g_LastCnn[33]
new Float:g_LastAdvert[33]

new g_Motorola
new g_Sony
new g_Nokia

new p_Ooc
new p_Cnn
new p_Advert
new p_Capscom
new p_Printconsole

new g_CallMenu[] = "DPRP_PhoneCallMenu"
new g_StatusMenu[] = "DPRP_PhoneStatusMenu"
new g_AnswerMenu[] = "DPRP_PhoneAnswerMenu"

new g_RingSound[] = "phone/ring.wav"
new g_SmsSound[] = "phone/sms.wav"

new g_Bugged[33]

new g_StatusMenuItems[ANSWER_ITEMS][] =
{
	"Status:",
	"Ring:",
	"Place Call"
}

new g_StatusSettings[STATUS_SETTINGS][] =
{
	"On",
	"Invisible",
	"Off"
}

new g_RingSettings[RING_SETTINGS][] =
{
	"Ring",
	"Vibrate",
	"Silent"
}

new g_Phone[33][PHONE]
new g_ItemId[33]

new g_MenuPage[33]

new g_ScanSound[] = "items/suitcharge1.wav"
new g_NotFoundSound[] = "items/suitchargeno1.wav"
new g_FoundSound[] = "items/suitchargeok1.wav"

public plugin_init()
{
	new Version[33]
	DPRP_Version(Version,32)
	register_plugin("DeepPurpleRP - Talkarea",Version,"Hawk552")
	
	register_clcmd("say","CmdSay")
	register_clcmd("say_team","CmdSay")
	
	DPRP_AddCommand("say /shout","<message> - shouts message")
	DPRP_AddCommand("say /cnn","<message> - sends news headline")
	DPRP_AddCommand("say /advert","<message> - advertises message")
	DPRP_AddCommand("say /ooc","<message> - sends message as OOC")
	DPRP_AddCommand("say /me","<action> - performs action")
	DPRP_AddCommand("say /com","(COP) <message> - sends message to all cops")
	DPRP_AddCommand("say /hangup","- hangs up phone")
	
	p_Ooc = register_cvar("dprp_ooc","1")
	p_Cnn = register_cvar("dprp_cnn","120")
	p_Advert = register_cvar("dprp_advert","60")
	p_Capscom = register_cvar("dprp_capscom","1")
	p_Printconsole = register_cvar("dprp_printconsole","1")

	register_menucmd(register_menuid(g_CallMenu),1023,"CallHandle")
	register_menucmd(register_menuid(g_StatusMenu),1023,"StatusHandle")
	register_menucmd(register_menuid(g_AnswerMenu),1023,"AnswerHandle")
	
	register_event("DeathMsg","EventDeathMsg","a")
}

public DPRP_Error(const Reason[])
	pause("d")

public plugin_precache()
{
	precache_sound(g_RingSound)
	precache_sound(g_SmsSound)
	precache_sound(g_ScanSound)
	precache_sound(g_NotFoundSound)
	precache_sound(g_FoundSound)
}

public DPRP_RegisterItems()
{
	g_Motorola = DPRP_RegisterItem("Motorola RAZR","_Phone","One of the smallest and best phones on the market.",0)
	g_Sony = DPRP_RegisterItem("Sony Ericsson","_Phone","One of the more functional phones on the market.",0)
	g_Nokia = DPRP_RegisterItem("Nokia 6820","_Phone","One of the more durable phones on the market.",0)
	
	DPRP_RegisterItem("Phone Subscription","_Subscription","Allows usage of a cell phone charged per minute.",0)
	DPRP_RegisterItem("Phone Prepaid Card","_Subscription","Allows usage of a cell phone for a certain amount of time.",0)
	
	DPRP_RegisterItem("Bug","_Bug","Used to tap into a user's communications and talking",1)
	DPRP_RegisterItem("Bug Scanner","_Scanner","Used to detect bugs",0)
}

public EventDeathMsg()
{
	new id = read_data(2)
	BreakLine(id,"'s line has gone dead.")
	g_Bugged[id] = 0
}

public client_disconnect(id)
{
	BreakLine(id," has disconnected. The phone has been hung up.")
	
	g_Bugged[id] = 0
}

BreakLine(id,Msg[])
{
	if(task_exists(id + PHONE_RING_OFFSET))
		remove_task(id + PHONE_RING_OFFSET)
	
	new Call = g_Phone[id][CALLER] ? g_Phone[id][CALLER] : g_Phone[id][CALLING],Name[33]
	if(!Call)
		return
		
	get_user_name(id,Name,32)
	client_print(Call,print_chat,"[DPRP] %s%s",Name,Msg)
	
	g_Phone[id][CALLER] = 0
	g_Phone[id][CALLING] = 0
	g_Phone[id][TALKING] = 0
	g_Phone[Call][CALLER] = 0
	g_Phone[Call][CALLING] = 0
	g_Phone[Call][TALKING] = 0
	
	DPRP_ItemDone(id)
	DPRP_ItemDone(Call)
}

public StatusHandle(id,Key)
{
	switch(Key)
	{
		case 0 :
		{
			if(g_Phone[id][MODE] == STATUS_SETTINGS - 1)
				g_Phone[id][MODE] = 0
			else
				g_Phone[id][MODE]++
				
			_Phone(id,g_ItemId[id])
		}
		case 1 :
		{
			if(g_Phone[id][RING] == RING_SETTINGS - 1)
				g_Phone[id][RING] = 0
			else
				g_Phone[id][RING]++
				
			_Phone(id,g_ItemId[id])
		}
		case 2 :
		{
			if(g_Phone[id][MODE] == 2)
			{
				client_print(id,print_chat,"[DPRP] Your phone is currently off.")
				return
			}
			
			new Menu[512],Pos,Keys = (1<<9),Players[32],Playersnum,Name[33],Num
			
			GetPhonePlayers(Players,Playersnum,id)
			
			Pos += formatex(Menu,511,"DeepPurpleRP Call Menu^n^n")
			
			for(new Count = g_MenuPage[id] * 7;Count < g_MenuPage[id] * 7 + 7;Count++)
			{
				if(Count >= Playersnum)
					break
				
				Keys |= (1<<Num)
				
				get_user_name(Players[Count],Name,32)					
				Pos += formatex(Menu[Pos],511 - Pos,"%d. %s^n",++Num,Name)
			}
			
			Pos += formatex(Menu[Pos],511 - Pos,"^n8. Last Page^n9. Next Page^n^n0. Exit")
			
			show_menu(id,Keys,Menu,-1,g_CallMenu)
		}
	}
}

public AnswerHandle(id,Key)
{
	if(Key)
		return
	
	if(task_exists(g_Phone[id][CALLER] + PHONE_RING_OFFSET))
		remove_task(g_Phone[id][CALLER] + PHONE_RING_OFFSET)
	
	client_print(id,print_chat,"[DPRP] The phone has been answered.")
	
	DPRP_ItemSet(g_Phone[id][CALLER])
	DPRP_ItemSet(id)
	
	g_Phone[g_Phone[id][CALLER]][TALKING] = 1
	g_Phone[id][TALKING] = 1
}

public CallHandle(id,Key)
{
	if(Key == 9)
		return PLUGIN_CONTINUE
	
	if(Key == 8)
	{
		new Players[32],Playersnum
		GetPhonePlayers(Players,Playersnum,id)
		
		if((g_MenuPage[id] + 1 * 7) < Playersnum)
			g_MenuPage[id]++
		
		StatusHandle(id,2)
		
		return PLUGIN_CONTINUE
	}
	if(Key == 7)
	{
		if(g_MenuPage[id])
			g_MenuPage[id]--
		
		StatusHandle(id,2)
		
		return PLUGIN_CONTINUE
	}	
	
	new Players[32],Playersnum,Selection
	GetPhonePlayers(Players,Playersnum,id)
	
	Selection = Players[g_MenuPage[id] * 7 + Key]
	
	if(!is_user_connected(Selection) || g_Phone[Selection][MODE])
		return client_print(id,print_chat,"[DPRP] Invalid user.")
	
	if(g_Phone[Selection][CALLER] || g_Phone[Selection][CALLING])
		return client_print(id,print_chat,"[DPRP] The line is busy.")
	
	if(g_Phone[Selection][RING] == 2)
		return set_task(6.0,"NoAnswer",id)
	
	new Menu[256],Name[33]
	get_user_name(id,Name,32)
	
	add(Menu,255,"DeepPurpleRP Call Menu^n^n")
	add(Menu,255,Name)
	add(Menu,255," is calling you^n^n1. Answer^n2. Ignore")
	
	g_Phone[Selection][CALLER] = id
	g_Phone[Selection][RINGING] = 0
	g_Phone[id][CALLING] = Selection
	
	if(g_Phone[Selection][RING] < 2)
		set_task(2.0,"Ring",Selection + PHONE_RING_OFFSET,"a",_,_,6)
	
	show_menu(Selection,(1<<0|1<<1),Menu,-1,g_AnswerMenu)
	
	return PLUGIN_CONTINUE
}

public Ring(id)
{
	id -= PHONE_RING_OFFSET
	
	if(++g_Phone[id][RINGING] >= 6)
	{
		if(task_exists(id + PHONE_RING_OFFSET))
			remove_task(id + PHONE_RING_OFFSET)
		
		NoAnswer(g_Phone[id][CALLER])
		
		return
	}
	
	if(g_Phone[id][RING] == 0)
		emit_sound(id,CHAN_AUTO,g_RingSound,1.0,ATTN_NORM,0,PITCH_NORM)
}

public NoAnswer(id)
	if(is_user_connected(id))
		client_print(id,print_chat,"[DPRP] You received no answer.")

public _Phone(id,ItemId)
{
	new Menu[256],Pos,Keys = (1<<9)
	
	Pos += formatex(Menu,255,"DeepPurpleRP Phone Menu^n^n")
	
	for(new Count;Count < ANSWER_ITEMS;Count++)
	{
		Keys |= (1<<Count)
		
		Pos += formatex(Menu[Pos],255 - Pos,"%d. %s ",Count + 1,g_StatusMenuItems[Count])
		
		if(Count == 0)
			Pos += formatex(Menu[Pos],255 - Pos,"%s",g_StatusSettings[g_Phone[id][MODE]])
		else if(Count == 1)
			Pos += formatex(Menu[Pos],255 - Pos,"%s",g_RingSettings[g_Phone[id][RING]])
		
		Pos += formatex(Menu[Pos],255 - Pos,"^n")
	}
	
	formatex(Menu[Pos],255 - Pos,"^n0. Exit")
	
	g_ItemId[id] = ItemId
	show_menu(id,Keys,Menu,-1,g_StatusMenu)
	
	DPRP_ItemDone(id)
}

public _Subscription(id,ItemId)
{
	DPRP_ItemDone(id)
}

public CmdSay(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
	
	new Args[256],Msg[512],Name[33],Mode
	read_args(Args,255)
	remove_quotes(Args)
	// going to use name as a temporary cache
	read_argv(0,Name,32)
	Mode = equali(Name,"say_team") ? 1 : 0
	get_user_name(id,Name,32)
	
	while(replace(Args,255,"%s","") || replace(Args,255,"%d","") || replace(Args,255,"%i","") || replace(Args,255,"%f","")) { }
	
	if(equali(Args,"/cnn",4))
	{
		new Float:Cnn = get_pcvar_float(p_Cnn)
		if(!Cnn)
		{
			client_print(id,print_chat,"[DPRP] CNN is currently disabled.")
			return PLUGIN_HANDLED
		}
		else if(get_gametime() - g_LastCnn[id] < Cnn)
		{
			client_print(id,print_chat,"[DPRP] You must wait before you issue another headline.")
			return PLUGIN_HANDLED
		}
		
		g_LastCnn[id] = get_gametime()
		
		replace(Args,255,"/cnn","")
		if(!strlen(Args))
			return PLUGIN_HANDLED
			
		format(Msg,255,"(CNN) %s: %s",Name,Args)
		
		client_print(0,print_chat,"%s",Msg)
		client_cmd(0,"spk fvox/alert")
	}
	else if(equali(Args,"/advert",7))
	{
		new Float:Advert = get_pcvar_float(p_Advert)
		if(!Advert)
		{
			client_print(id,print_chat,"[DPRP] Advertising is currently disabled.")
			return PLUGIN_HANDLED
		}
		else if(get_gametime() - g_LastAdvert[id] < Advert)
		{
			client_print(id,print_chat,"[DPRP] You must wait before you issue another advertisement.")
			return PLUGIN_HANDLED
		}
		
		g_LastAdvert[id] = get_gametime()
		
		replace(Args,255,"/advert","")
		if(!strlen(Args))
			return PLUGIN_HANDLED
			
		format(Msg,255,"(ADVERT) %s: %s",Name,Args)
		
		client_print(0,print_chat,"%s",Msg)
	}
	else if(equali(Args,"/ooc",4))
	{
		if(!get_pcvar_num(p_Ooc))
		{
			client_print(id,print_chat,"[DPRP] OOC chat is currently disabled.")
			return PLUGIN_HANDLED
		}
		
		replace(Args,255,"/ooc","")
		if(!strlen(Args))
			return PLUGIN_HANDLED
		
		format(Msg,255,"%s: (( %s ))",Name,Args)
		
		client_print(0,print_chat,"%s",Msg)
	}
	else if(equali(Args,"/me",3) || equali(Args,"/action",7))
	{
		replace(Args,255,"/me","")
		format(Msg,255,"(ACTION) %s %s",Name,Args)
		
		new Players[32],Playersnum
		get_players(Players,Playersnum,"ac")
			
		for(new Count;Count < Playersnum;Count++)
			Message(id,Players[Count],400.0,Msg)
	}
	else if(equali(Args,"/shout",6))
	{
		replace(Args,255,"/shout","")
		new Len = strlen(Args)
		if(!Len)
			return PLUGIN_HANDLED
		
		for(new Count;Count < Len;Count++)
			Args[Count] = toupper(Args[Count])
			
		format(Msg,255,"(SHOUT) %s: %s",Name,Args)
		
		new Players[32],Playersnum
		get_players(Players,Playersnum,"ac")
			
		for(new Count;Count < Playersnum;Count++)
			Message(id,Players[Count],800.0,Msg)
		
		PrintBugMessage(id,Msg)
	}		
	else if(equali(Args,"/quiet",6) || equali(Args,"/whisper",8))
	{
		replace(Args,255,"/quiet","")
		replace(Args,255,"/whisper","")
		
		new Len = strlen(Args)
		if(!Len)
			return PLUGIN_HANDLED
		
		for(new Count;Count < Len;Count++)
			Args[Count] = tolower(Args[Count])
		
		format(Msg,255,"(QUIET) %s: ... %s ...",Name,Args)
		
		new Players[32],Playersnum
		get_players(Players,Playersnum,"ac")
			
		for(new Count;Count < Playersnum;Count++)
			Message(id,Players[Count],200.0,Msg)
		
		PrintBugMessage(id,Msg)
	}
	else if(equali(Args,"/com",4))
	{
		if(!DPRP_IsCop(id))
		{
			client_print(id,print_chat,"[DPRP] You are not part of the police force.")
			return PLUGIN_HANDLED
		}
	
		replace(Args,255,"/com","")
		
		new Len = strlen(Args)
		if(!Len)
			return PLUGIN_HANDLED
		
		if(get_pcvar_num(p_Capscom))
			for(new Count;Count < Len;Count++)
				Args[Count] = toupper(Args[Count])
			
		format(Msg,255,"(COM) %s: %s",Name,Args)
		
		new Players[32],Playersnum
		get_players(Players,Playersnum,"ac")
			
		for(new Count;Count < Playersnum;Count++)
			if(DPRP_IsCop(Players[Count]))
				client_print(Players[Count],print_chat,"%s",Msg)
		
		PrintBugMessage(id,Msg)
	}
	else if(equali(Args,"/hangup",7))
	{
		if(!g_Phone[id][CALLER] && !g_Phone[id][CALLING])
		{
			client_print(id,print_chat,"[DPRP] You are not on the phone.")
			return PLUGIN_HANDLED
		}
		
		new Call = g_Phone[id][CALLER] ? g_Phone[id][CALLER] : g_Phone[id][CALLING]
		
		client_print(id,print_chat,"[DPRP] You have hung up the phone.")
		client_print(Call,print_chat,"[DPRP] The phone has been hung up.")
		
		g_Phone[id][CALLER] = 0
		g_Phone[id][CALLING] = 0
		g_Phone[Call][CALLER] = 0
		g_Phone[Call][CALLING] = 0
		
		DPRP_ItemDone(id)
		DPRP_ItemDone(Call)
	}
	else if(equali(Args,"/sms",4))
	{
		if(!DPRP_GetUserItemNum(id,g_Motorola) && !DPRP_GetUserItemNum(id,g_Nokia) && !DPRP_GetUserItemNum(id,g_Sony))
		{
			client_print(id,print_chat,"[DPRP] You do not have a phone.")
			return PLUGIN_HANDLED
		}
		
		new Target[33]
		replace(Args,255,"/sms","")
		remove_quotes(Args)
		trim(Args)
		
		parse(Args,Target,32,Msg,1)
		copy(Msg,255,Args)
		replace(Msg,255,Target,"")
		trim(Msg)
		
		new Index = cmd_target(id,Target,0)
		if(!Index || !is_user_alive(Index))
		{
			client_print(id,print_chat,"[DPRP] Could not find a user matching your input.")
			return PLUGIN_HANDLED
		}
		
		if(!DPRP_GetUserItemNum(Index,g_Motorola) && !DPRP_GetUserItemNum(Index,g_Nokia) && !DPRP_GetUserItemNum(Index,g_Sony))
		{
			client_print(id,print_chat,"[DPRP] That user does not have a phone.")
			return PLUGIN_HANDLED
		}
		
		client_print(Index,print_chat,"(SMS) %s: %s",Name,Msg)
		client_print(id,print_chat,"(SMS) %s: %s",Name,Msg)
		
		emit_sound(id,CHAN_AUTO,g_SmsSound,1.0,ATTN_NORM,0,PITCH_NORM)
	}
	else
	{
		if(!strlen(Args))
			return PLUGIN_HANDLED
		
		if(Mode)
		{
			if(!get_pcvar_num(p_Ooc))
			{
				client_print(id,print_chat,"[DPRP] OOC chat is currently disabled.")
				return PLUGIN_HANDLED
			}
			
			format(Msg,255,"%s: (( %s ))",Name,Args)
			
			if(equali(Args,"//",2))
			{
				new Players[32],Playersnum
				get_players(Players,Playersnum)
				
				for(new Count;Count < Playersnum;Count++)
					Message(id,Players[Count],200.0,Msg)
			}
			else
				client_print(0,print_chat,"%s",Msg)
		}
		else
		{
			new Call = g_Phone[id][CALLER] ? g_Phone[id][CALLER] : g_Phone[id][CALLING]
			if(Call && (g_Phone[Call][CALLER] == id || g_Phone[Call][CALLING] == id) && g_Phone[Call][TALKING] == 1 && g_Phone[id][TALKING] == 1)
			{
				format(Msg,511,"(PHONE) %s : %s",Name,Args)
				client_print(Call,print_chat,"%s",Msg)
				client_print(id,print_chat,"%s",Msg)
				
				PrintBugMessage(id,Msg)
				
				return PLUGIN_HANDLED
			}
			
			format(Msg,511,"%s: %s",Name,Args)
			
			new Players[32],Playersnum
			get_players(Players,Playersnum,"ac")
			
			for(new Count;Count < Playersnum;Count++)
				Message(id,Players[Count],400.0,Msg)
			
			PrintBugMessage(id,Msg)
		}
	}
	
	if(get_pcvar_num(p_Printconsole))
		server_print("%s",Msg)
	
	return PLUGIN_HANDLED
}

// thanks to the harbu code for this, was too lazy to rewrite it
Message(sender,reciever,Float:Dist,const Msg[])
{
	new Float:SndOrigin[3],Float:RcvOrigin[3]
	entity_get_vector(reciever,EV_VEC_origin,RcvOrigin)
	entity_get_vector(sender,EV_VEC_origin,SndOrigin)	
	
	if(get_distance_f(RcvOrigin,SndOrigin) <= Dist)
		client_print(reciever,print_chat,"%s",Msg)
}

GetPhonePlayers(Players[32],&Playersnum,Player)
{
	for(new id = 1;id <= 32;id++)
	{		
		if(!is_user_connected(id) || !is_user_alive(id) || (!DPRP_GetUserItemNum(id,g_Motorola) && !DPRP_GetUserItemNum(id,g_Nokia) && !DPRP_GetUserItemNum(id,g_Sony)) || id == Player)
			continue
		
		Players[Playersnum++] = id
	}
	/*get_players(Players,Playersnum,"ac")
	
	for(new Count,id;Count < Playersnum;Count++)
	{
		id = Players[Count]
		if((!DPRP_GetUserItemNum(id,MOTOROLA_ID) && !DPRP_GetUserItemNum(id,NOKIA_ID) && !DPRP_GetUserItemNum(id,SONY_ID)) || id == Player)
		{
			Pop(Players,Count)
			Playersnum--
		}
	}*/
}

public _Bug(id,ItemId)
{
	DPRP_ItemDone(id)
	
	new Index,Body
	get_user_aiming(id,Index,Body,100)
	
	if(!Index || !is_user_alive(Index))
		return client_print(id,print_chat,"[DPRP] You are not looking at any people to bug.")
	
	g_Bugged[Index] |= (1<<id)
	
	new Name[33]
	get_user_name(Index,Name,32)
	
	return client_print(id,print_chat,"[DPRP] You have bugged %s.",Name)
}

public _Scanner(id,ItemId)
{
	DPRP_ItemDone(id)
	
	new Index,Body
	get_user_aiming(id,Index,Body,100)
	
	if(!Index || !is_user_alive(Index))
		Index = id
	
	emit_sound(id,CHAN_ITEM,g_ScanSound,VOL_NORM,ATTN_NORM,0,PITCH_NORM)
	
	if(Index == id)
		client_print(id,print_chat,"[DPRP] You begin scanning yourself.")
	else
	{
		new Name[33]
		get_user_name(id,Name,32)
		client_print(Index,print_chat,"[DPRP] %s is scanning you for bugs.",Name)
		
		get_user_name(Index,Name,32)
		client_print(id,print_chat,"[DPRP] You are scanning %s for bugs.",Name)
	}
	
	new Params[2]
	Params[0] = id
	Params[1] = Index
	set_task(5.0,"Scan",_,Params,2)
}

public Scan(Params[2])
{
	new id = Params[0],Index = Params[1],Players[32],Playersnum,Bugsnum
	get_players(Players,Playersnum)
	
	for(new Count;Count < Playersnum;Count++)
		if(g_Bugged[Index] & (1<<Players[Count]))
			Bugsnum++
	
	if(Bugsnum)
	{
		emit_sound(id,CHAN_ITEM,g_FoundSound,VOL_NORM,ATTN_NORM,0,PITCH_NORM)
		
		if(Index == id)
			client_print(id,print_chat,"[DPRP] You found %d bugs on yourself and removed them.",Bugsnum)
		else
		{
			new Name[33]
			get_user_name(id,Name,32)
			client_print(Index,print_chat,"[DPRP] %s scanned you and found %d bugs, which were removed.",Name,Bugsnum)
			
			get_user_name(Index,Name,32)
			client_print(id,print_chat,"[DPRP] You scanned %s and found %d bugs which you removed.",Name,Bugsnum)
		}
	}
	else
	{
		emit_sound(id,CHAN_ITEM,g_NotFoundSound,VOL_NORM,ATTN_NORM,0,PITCH_NORM)
		
		if(Index == id)
			client_print(id,print_chat,"[DPRP] You found no bugs on yourself.")
		else
		{
			new Name[33]
			get_user_name(id,Name,32)
			client_print(Index,print_chat,"[DPRP] %s scanned you and found no bugs.",Name)
			
			get_user_name(Index,Name,32)
			client_print(id,print_chat,"[DPRP] You scanned %s and found no bugs.",Name)
		}
	}
	
	g_Bugged[Index] = 0
}

PrintBugMessage(id,Msg[])
{
	new Players[32],Playersnum
	get_players(Players,Playersnum,"ac")
			
	for(new Count;Count < Playersnum;Count++)
		if(g_Bugged[id] & (1<<Players[Count]))
			client_print(Players[Count],print_chat,"[BUG] %s",Msg)
}

// Not a true pop, but I couldn't think of anything else to call it
/*Pop(Array[32],Num)
{	
	new Size = sizeof Array
	
	for(new Count = Num;Count < Size;Count++)
		Array[Count] = Array[Count + 1]

	Array[Size - 1] = 0
	
	return 1
}*/
